<?php
$this->breadcrumbs=array(
	'Clienti'=>array('index'),
	$model->id,
);

$baseUrl = Yii::app()->baseUrl; 
  $cs = Yii::app()->getClientScript();
  $cs->registerCssFile($baseUrl.'/css/styles.css');
?>
<h1><?php echo $model->nome.' '.$model->cognome; ?></h1>
<h2>Appuntamenti fissati</h2>
<?php
function trattamentiLista($lista) {
	if (count($lista) != null) { ?>
		<div class="grid-view"> 
<table class="items">
	<?php foreach($lista as $tratt) { ?>
	<tr<?php if($i%2==0) echo ' class="odd"'; else echo ' class="even"'; $i++; ?>>
		<td width="45%"><?php echo $tratt['nome']; ?></td>
		<td width="45%"><?php 
			$tempo = DATETIME::createFromFormat("Y-m-d H:i:s",$tratt['data']);
		echo $tempo->format("d-m-Y (H:i)"); 
		?></td>
		<td width="10%"><?php echo CHtml::link('Vedi',array('site/index','data'=>$tempo->format("Y-m-d"),'id'=>$tratt['id'])); ?></td>
	</tr>
	<?php } ?>
</table></div>
<?php }
	 else if (count($lista)==0) {
		echo '<p>Nessun appuntamento.</p>';
	}
}

trattamentiLista($trattamentiPresenti);
?>
<h2>Passato</h2>
<?php
trattamentiLista($trattamentiPassati);
?>